# PowerShell script to launch the Blind Box Application

$mavenRepo = "C:\Users\22399\.m2\repository"
$springBootVersion = "3.2.0"

# Initialize classpath
$classpath = "d:\Code\blind-box-after-work\backend\target\classes"

# Add Apache Commons Logging
$classpath += ";$mavenRepo\commons-logging\commons-logging\1.2\commons-logging-1.2.jar"

# Add Spring Boot core dependencies
$classpath += ";$mavenRepo\org\springframework\boot\spring-boot\$springBootVersion\spring-boot-$springBootVersion.jar"
$classpath += ";$mavenRepo\org\springframework\boot\spring-boot-autoconfigure\$springBootVersion\spring-boot-autoconfigure-$springBootVersion.jar"
$classpath += ";$mavenRepo\org\springframework\boot\spring-boot-starter\$springBootVersion\spring-boot-starter-$springBootVersion.jar"

# Add Spring Framework core dependencies
$classpath += ";$mavenRepo\org\springframework\spring-context\6.1.1\spring-context-6.1.1.jar"
$classpath += ";$mavenRepo\org\springframework\spring-web\6.1.1\spring-web-6.1.1.jar"
$classpath += ";$mavenRepo\org\springframework\spring-beans\6.1.1\spring-beans-6.1.1.jar"
$classpath += ";$mavenRepo\org\springframework\spring-core\6.1.1\spring-core-6.1.1.jar"
$classpath += ";$mavenRepo\org\springframework\spring-webmvc\6.1.1\spring-webmvc-6.1.1.jar"
$classpath += ";$mavenRepo\org\springframework\spring-aop\6.1.1\spring-aop-6.1.1.jar"
$classpath += ";$mavenRepo\org\springframework\spring-expression\6.1.1\spring-expression-6.1.1.jar"
$classpath += ";$mavenRepo\org\springframework\spring-jcl\6.1.1\spring-jcl-6.1.1.jar"

# Add Jackson dependencies
$classpath += ";$mavenRepo\com\fasterxml\jackson\core\jackson-databind\2.15.2\jackson-databind-2.15.2.jar"
$classpath += ";$mavenRepo\com\fasterxml\jackson\core\jackson-core\2.15.2\jackson-core-2.15.2.jar"
$classpath += ";$mavenRepo\com\fasterxml\jackson\core\jackson-annotations\2.15.2\jackson-annotations-2.15.2.jar"
$classpath += ";$mavenRepo\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.15.2\jackson-datatype-jsr310-2.15.2.jar"

# Add SnakeYAML for YAML configuration
$classpath += ";$mavenRepo\org\yaml\snakeyaml\2.2\snakeyaml-2.2.jar"

# Add OpenAPI and Swagger dependencies
$classpath += ";$mavenRepo\io\swagger\core\v3\swagger-models\2.2.20\swagger-models-2.2.20.jar"
$classpath += ";$mavenRepo\io\swagger\core\v3\swagger-annotations\2.2.20\swagger-annotations-2.2.20.jar"

# Display classpath information
Write-Host "Classpath set with dependencies"

# Check if the main class exists
if (Test-Path "d:\Code\blind-box-after-work\backend\target\classes\com\downbox\BlindBoxApplication.class") {
    Write-Host "Main class found"
} else {
    Write-Host "Main class NOT found"
    Get-ChildItem -Recurse -Path "d:\Code\blind-box-after-work\backend\target\classes" | Select-Object FullName
}

# Launch the application
Write-Host "Starting Blind Box Application..."
java -cp "$classpath" com.downbox.BlindBoxApplication